package com.sbbs.service.impl;

import com.sbbs.bean.Bill;
import com.sbbs.dao.BillDao;
import com.sbbs.service.BillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BillServiceImpl implements BillService {

    @Autowired
    private BillDao billDao;

    @Override
    public List<Bill> searchByMsg(Integer typeId, String fromDate, String toDate) {
        return billDao.searchByMsg(typeId, fromDate, toDate);
    }

    @Override
    public List<Bill> searchAll() {
        return searchByMsg(null, null, null);
    }

    @Override
    public Bill getById(Integer id) {
        return billDao.selectByPrimaryKey(id);
    }

    @Override
    public int insert(Bill bill) {
        return billDao.insert(bill);
    }

    @Override
    public int updateById(Bill newBill) {
        return billDao.updateByPrimaryKey(newBill);
    }

    @Override
    public int deleteById(Integer id) {
        return billDao.deleteByPrimaryKey(id);
    }
}
